//
//  BaseTableViewCell.m
//  WhereToTravel
//
//  Created by dlios on 15/10/12.
//  Copyright © 2015年 zhoushengmin. All rights reserved.
//

#import "BaseTableViewCell.h"

@implementation BaseTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
        [[NSNotificationCenter defaultCenter] postNotificationName:@"night" object:nil];
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(night) name:@"night" object:nil];
    }
    return self;
}

- (void)createView {
    self.upLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.upLabel];
    self.upLabel.numberOfLines = 0;
    self.upLabel.backgroundColor = [UIColor clearColor];
    
    self.mistLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.mistLabel];
    self.mistLabel.backgroundColor = [UIColor clearColor];

    self.downLeftLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.downLeftLabel];
    self.downLeftLabel.backgroundColor = [UIColor clearColor];

    self.downRightLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.downRightLabel];
    self.downRightLabel.backgroundColor = [UIColor clearColor];
    
    self.downMistLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.downMistLabel];
    self.downMistLabel.backgroundColor = [UIColor clearColor];

    self.downLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.downLabel];
    self.downLabel.backgroundColor = [UIColor clearColor];

    self.titleLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.titleLabel];
    self.titleLabel.backgroundColor = [UIColor clearColor];

    self.upLeftLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.upLeftLabel];
    self.upLeftLabel.backgroundColor = [UIColor clearColor];
    
    self.upRightLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.upRightLabel];
    self.upRightLabel.backgroundColor = [UIColor clearColor];

    
    self.topLabel = [[UILabel alloc]init];
    [self.contentView addSubview:self.topLabel];
    self.leftLabel = [[UILabel alloc]init];
    [self.contentView addSubview:self.leftLabel];
    self.rightLabel = [[UILabel alloc]init];
    [self.contentView addSubview:self.rightLabel];
    self.numberLabel = [[UILabel alloc]init];
    [self.contentView addSubview:self.numberLabel];
    self.userLabel = [[UILabel alloc]init];
    [self.contentView addSubview:self.userLabel];
    self.contentLabel = [[UILabel alloc]init];
    [self.contentView addSubview:self.contentLabel];

}

- (void)night {
    if ([SingletonNight shareSingletonNight].isSelete == YES) {
        self.upLabel.textColor = [UIColor whiteColor];
        self.mistLabel.textColor = [UIColor whiteColor];
        self.downLeftLabel.textColor = [UIColor whiteColor];
        self.downRightLabel.textColor = [UIColor whiteColor];
        self.downLabel.textColor = [UIColor whiteColor];
        self.downMistLabel.textColor = [UIColor whiteColor];
        self.titleLabel.textColor = [UIColor whiteColor];
        self.upLeftLabel.textColor = [UIColor whiteColor];
        self.upRightLabel.textColor = [UIColor whiteColor];
        self.topLabel.textColor = [UIColor whiteColor];
        self.userLabel.textColor = [UIColor whiteColor];
        self.contentLabel.textColor = [UIColor whiteColor];
    }
    else {
        self.upLabel.textColor = [UIColor blackColor];
        self.mistLabel.textColor = [UIColor blackColor];
        self.downLeftLabel.textColor = [UIColor blackColor];
        self.downRightLabel.textColor = [UIColor blackColor];
        self.downMistLabel.textColor = [UIColor blackColor];
        self.downLabel.textColor = [UIColor blackColor];
        self.titleLabel.textColor = [UIColor blackColor];
        self.upLeftLabel.textColor = [UIColor blackColor];
        self.upRightLabel.textColor = [UIColor blackColor];
        self.topLabel.textColor = [UIColor blackColor];
        self.userLabel.textColor = [UIColor colorWithWhite:0.673 alpha:1.000];
        self.contentLabel.textColor = [UIColor colorWithWhite:0.673 alpha:1.000];

    }
}

- (void)dealloc
{
    [[NSNotificationCenter defaultCenter] removeObserver:self name:@"night" object:nil];
}


@end
